using System;
using System.Collections.Generic;

namespace Flood.Log
{
	public class ShapeAddedSquares : IChange
	{
		private readonly Action<Square> removeFromParts;
		private readonly Shape shape;
		private readonly List<Square> squares;

		public ShapeAddedSquares(Shape shape, Action<Square> removeFromParts, List<Square> squares)
		{
			this.shape = shape;
			this.removeFromParts = removeFromParts;
			this.squares = squares;
		}

		#region IChange Members

		public Shape Shape
		{
			get { return shape; }
		}

		public void Undo()
		{
			squares.ForEach(removeFromParts);
		}

		#endregion
	}
}